/**
 * 存储天气有关的信息
 */

import Cookies from "js-cookie";

const weather = "WEATHER_INFORMATION";

/**
 * 获取天气相关信息
 */
export function getWeatherInformation() {
    return Cookies.get(weather);
}

/**
 * 设置天气相关信息
 */
export function setWeatherInformation(information) {
    return Cookies.set(weather, information);
}

/**
 * 移除天气相关信息
 */
export function removeWeatherInformation(){
    return Cookies.remove(weather);
}

/**
 * 根据天气返回相应的配送费
 */
export function getFee(weather){
    var sunny=['晴','多云'];
    if(sunny.includes(weather)){
        return '2';
    }

    var overcast=['阴'];
    if(overcast.includes(weather)){
        return '3';
    }

    var rainy=['阵雨','雷阵雨','雷阵雨伴有冰雹','雨夹雪','小雨','中雨','大雨','暴雨','大暴雨','特大暴雨'
        ,'小到中雨','中到大雨','大到暴雨','暴雨到大暴雨','大暴雨到特大暴雨'];
    if(rainy.includes(weather)){
        return '6';
    }

    var snow=['阵雪','小雪','中雪','大雪','暴雪','小到中雪','中到大雪','大到暴雪'];
    if(snow.includes(weather)){
        return '6';
    }

    var fog=['雾','冻雨','沙尘暴','浮尘','扬沙','强沙尘暴','霾'];
    if(fog.includes(weather)){
        return '6';
    }
}